"""
    字典其实就相当于 js 中的对象
"""
"""
my_dict = {"name": 'st', "age": 22}
dict1 = dict()  # 定义一个空字典
print(type(my_dict))
print(my_dict['name'])

# 字典常用操作
# 更新
my_dict['name'] = 'sr'

# 插入
my_dict['gender'] = '男'

# 删除
val = my_dict.pop('age')
print(val)

# 清空字典
my_dict.clear()
print(my_dict)

# 取出字典所有的key
my_dict = {"name": 'st', "age": 22, 'gender': '男'}
keys = my_dict.keys()

# 遍历
for ele in keys:
    print(my_dict[ele])

# 也可以直接遍历
for ele in my_dict:
    print(my_dict[ele])
"""
# 小案例
staff_data = [
    {
        "fullname": '王力宏',
        'department': '科技部',
        'wages': '3000',
        'level': '1'
    },
    {
        "fullname": '周杰伦',
        'department': '市场部',
        'wages': '5000',
        'level': '2'
    },
    {
        "fullname": '林俊杰',
        'department': '市场部',
        'wages': '7000',
        'level': '3'
    },
    {
        "fullname": '张学友',
        'department': '科技部',
        'wages': '4000',
        'level': '1'
    },
    {
        "fullname": '刘德华',
        'department': '市场部',
        'wages': '6000',
        'level': '2'
    }
]
print(f'全体员工当前信息如下{staff_data}')
for item in staff_data:
    if item['level'] == '1':
        item['level'] = '2'
        item['wages'] = int(item['wages']) + 1000

print(f"加完工资的员工信息{staff_data}")